<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
            + "/dir/";
%>
<c:set var="bp" value="<%=basePath%>"></c:set>
<html>
<head>
    <title>商家列表信息页面</title>
    <c:import url="hcommon.jsp"></c:import>
    <c:import url="header.jsp"></c:import>
    <c:import url="left.jsp"></c:import>
    <script>
	function choose(obj) {
		console.log(obj)
		if (obj.checked == true) {
			$("[name='ids']").prop("checked", true);
		} else {
			$("[name='ids']").prop("checked", false);
		}
	}
	$(function () {
        $("tr").each(function () {
            var scondition = $(this).children("td:eq(6)").text();
            var audit = $(this).children("td:eq(7)").text();
            if (scondition == "营业") {
                $(this).children("td:eq(6)").css("background-color", "green");
            } else if (scondition != "营业") {
                $(this).children("td:eq(6)").css("background-color", "red");
            }
            if (audit == "已审核") {
                $(this).children("td:eq(7)").css("background-color", "green");
            } else if (audit == "未审核") {
                $(this).children("td:eq(7)").css("background-color", "red");
            }
        });
    });

    </script>
</head>
<body>
<div style="margin-top:80px ;margin-left: 240px">
    <div style="margin-left: 1200px">
        <form method="post" action="storefindByName.action">
            <input type="search" name="sname" placeholder="请输入门店名称">
            <input
                    value="查询"
                    type="submit"/>
        </form>
    </div>
    <form action="deleteStore.action" method="post">
        <table class="table table-hover">
            <tr>
                <th><input type="checkbox" value="全选/全部选" onclick="choose(this)"/></th>
                <th>门店编号</th>
                <th>门店名称</th>
                <th>门店地址</th>
                <th>门店照片</th>
                <th>营业执照</th>
                <th>营业状态</th>
                <th>审核状态</th>
                <th>红包编号</th>
                <th>红包类型</th>
                <th>门店评分</th>
                <th>营业额</th>
                <th>评价编号</th>
                <th>评价内容</th>
                <th>option</th>
            </tr>
            <c:forEach var="inv" items="${list}">
                <tr>
                    <td><input name="ids" type="checkbox" value="${inv.sid}"/></td>
                    <td><a href="storefindbyid.action?sid=${inv.sid}">${inv.sid}</a></td>
                    <td>${inv.sname}</td>
                    <td>${inv.saddress}</td>
                    <td><IMG src="${bp}${inv.picture}" width="60px" height="60px"></td>
                    <td><IMG src="${bp}${inv.businesslicense}" width="60px" height="60px"></td>
                    <td><a href="scondition.action?sid=${inv.sid}">${inv.scondition}</a></td>
                    <td><a href="audit.action?sid=${inv.sid}">${inv.audit}</a></td>
                    <td>${inv.rid}</td>
                    <td>${inv.redpacket.rtype}</td>
                    <td>${inv.sgrade}</td>
                    <td>${inv.income}</td>
                    <td>${inv.eid}</td>
                    <td>${inv.evaluate.econtex}</td>
                    <td><input onclick="javascript:location.href='toupdateStore.action?sid=${inv.sid}'"
                               value="修改" type="button"/></td>
                </tr>
            </c:forEach>
            <tr align="center">
                <td colspan="10"><input
                        onclick="javascript:location.href='toaddStore.action'" value="添加"
                        type="button"/> <input value="删除" type="submit"/></td>
            </tr>
        </table>
    </form>
</div>
</body>
</html>
